/// timeScope : "2024年7月12至今"
/// stepCnt : 27743
/// avgStepCnt : 27743
/// mileCnt : 2.3
/// maxValue : 100
/// curveData : [{"time":"周一","curveDateItems":[{"key":"","value":93},{"key":"","value":84}]},{"time":"周二","curveDateItems":[{"key":"","value":23},{"key":"","value":29}]},{"time":"周三","curveDateItems":[{"key":"","value":25},{"key":"","value":31}]},{"time":"周四","curveDateItems":[{"key":"","value":99},{"key":"","value":25}]},{"time":"周五","curveDateItems":[{"key":"","value":59},{"key":"","value":15}]},{"time":"周六","curveDateItems":[{"key":"","value":20},{"key":"","value":82}]},{"time":"周天","curveDateItems":[{"key":"","value":88},{"key":"","value":76}]}]

class HealthDataModel {
  HealthDataModel({
    String? timeScope,
    num? stepCnt,
    num? avgStepCnt,
    num? mileCnt,
    num? maxValue,
    List<CurveData>? curveData,
  }) {
    _timeScope = timeScope;
    _stepCnt = stepCnt;
    _avgStepCnt = avgStepCnt;
    _mileCnt = mileCnt;
    _maxValue = maxValue;
    _curveData = curveData;
  }

  HealthDataModel.fromJson(dynamic json) {
    _timeScope = json['timeScope'];
    _stepCnt = json['stepCnt'];
    _avgStepCnt = json['avgStepCnt'];
    _mileCnt = json['mileCnt'];
    _maxValue = json['maxValue'];
    if (json['curveData'] != null) {
      _curveData = [];
      json['curveData'].forEach((v) {
        _curveData?.add(CurveData.fromJson(v));
      });
    }
  }

  String? _timeScope;
  num? _stepCnt;
  num? _avgStepCnt;
  num? _mileCnt;
  num? _maxValue;
  List<CurveData>? _curveData;

  HealthDataModel copyWith({
    String? timeScope,
    num? stepCnt,
    num? avgStepCnt,
    num? mileCnt,
    num? maxValue,
    List<CurveData>? curveData,
  }) =>
      HealthDataModel(
        timeScope: timeScope ?? _timeScope,
        stepCnt: stepCnt ?? _stepCnt,
        avgStepCnt: avgStepCnt ?? _avgStepCnt,
        mileCnt: mileCnt ?? _mileCnt,
        maxValue: maxValue ?? _maxValue,
        curveData: curveData ?? _curveData,
      );

  String? get timeScope => _timeScope;

  num? get stepCnt => _stepCnt;

  num? get avgStepCnt => _avgStepCnt;

  num? get mileCnt => _mileCnt;

  num? get maxValue => _maxValue;

  List<CurveData>? get curveData => _curveData;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['timeScope'] = _timeScope;
    map['stepCnt'] = _stepCnt;
    map['avgStepCnt'] = _avgStepCnt;
    map['mileCnt'] = _mileCnt;
    map['maxValue'] = _maxValue;
    if (_curveData != null) {
      map['curveData'] = _curveData?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

/// time : "周一"
/// curveDateItems : [{"key":"","value":93},{"key":"","value":84}]

class CurveData {
  CurveData({
    String? time,
    List<CurveDateItems>? curveDateItems,
  }) {
    _time = time;
    _curveDateItems = curveDateItems;
  }

  CurveData.fromJson(dynamic json) {
    _time = json['time'];
    if (json['curveDateItems'] != null) {
      _curveDateItems = [];
      json['curveDateItems'].forEach((v) {
        _curveDateItems?.add(CurveDateItems.fromJson(v));
      });
    }
  }

  String? _time;
  List<CurveDateItems>? _curveDateItems;

  CurveData copyWith({
    String? time,
    List<CurveDateItems>? curveDateItems,
  }) =>
      CurveData(
        time: time ?? _time,
        curveDateItems: curveDateItems ?? _curveDateItems,
      );

  String? get time => _time;

  List<CurveDateItems>? get curveDateItems => _curveDateItems;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['time'] = _time;
    if (_curveDateItems != null) {
      map['curveDateItems'] = _curveDateItems?.map((v) => v.toJson()).toList();
    }
    return map;
  }
}

/// key : ""
/// value : 93

class CurveDateItems {
  CurveDateItems({
    String? key,
    num? value,
  }) {
    _key = key;
    _value = value;
  }

  CurveDateItems.fromJson(dynamic json) {
    _key = json['key'];
    _value = json['value'];
  }

  String? _key;
  num? _value;

  CurveDateItems copyWith({
    String? key,
    num? value,
  }) =>
      CurveDateItems(
        key: key ?? _key,
        value: value ?? _value,
      );

  String? get key => _key;

  num? get value => _value;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['key'] = _key;
    map['value'] = _value;
    return map;
  }
}
